<template>
  <div>
    <van-tabs @click="tabClick($event)">
      <van-tab v-for="item in arr" :key="item.id" :title="item.catename"></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { getHomeCate } from "../../../http/http";
export default {
  data() {
    return {
      arr: [],
    };
  },
  methods:{
      tabClick(e){
          this.$router.push("/list?id="+(e+1)+'&type=1')
      }
  },
  mounted() {
    getHomeCate().then((res) => {
      this.arr = res.data.list;
    });
  },
};
</script>

<style scoped>
.item {
  display: inline-block;
  padding: 0.1rem;
  margin-right: 0.1rem;
  color: teal;
}
</style>